package com.halflife.websocket.service;


import com.alibaba.fastjson.JSON;
import com.halflife.websocket.entity.Client;

public class RequestService {

    /**
     * 根据客户端的请求生成 Client
     *
     * @param request 例如 {id:1;rid:21;token:'43606811c7305ccc6abb2be116579bfd'}
     * @return
     */
    public static Client clientRegister(String request) {
        Client client = (Client) JSON.parse(request);

        return client;
    }

    /**
     * 从 redis 里根据 id 获取 token 与之对比
     *
     * @param id
     * @param token
     * @return
     */
    private static boolean checkToken(Long id, String token) {
        return true;
    }
}
